package com.mlnx.bluwifi.manager.datalis;

import com.mlnx.bluwifi.service.WifiBluService;
import com.mlnx.bluwifi.tp.zhengkbp.ZhengKBpPacket;
import com.mlnx.common.utils.MyLog;

/**
 * Created by amanda.shan on 2019/11/20.
 */
public class DefaultBpLis implements ZhengKBpPacket.BpLis {

    MyLog log = MyLog.getLog(getClass());

    private String deviceId;

    private WifiBluService wifiBluService;

    public DefaultBpLis(String deviceId, WifiBluService wifiBluService) {
        this.deviceId = deviceId;
        this.wifiBluService = wifiBluService;
    }

    @Override
    public void bp(long time, int sbp, int dbp, int heart, boolean heartEror) {
        wifiBluService.broadCastBp(deviceId, sbp, dbp, heart);
    }

    @Override
    public void pressure(int pressure) {
        log.debug("{} 设备压力 : {}", deviceId, pressure);
    }

    @Override
    public void commandOK() {

    }

    @Override
    public void commandError(String msg) {
        log.error("{} 执行命令失败:{}", deviceId, msg);
    }

    @Override
    public void error(String msg) {
        log.error("{} 设备错误: {}", deviceId, msg);
    }

    @Override
    public void heartBeat() {
        log.debug("{} 设备检测到心跳", deviceId);
    }
}
